package com.inspur.edp.metadata.rtcustomization.servermanager.dac.db;

import com.inspur.edp.metadata.rtcustomization.api.entity.GspEmbeddedMdRtContent;
import com.inspur.edp.metadata.rtcustomization.api.entity.GspMdRtContentSuInfo;
import com.inspur.edp.metadata.rtcustomization.servermanager.dac.MetadataRtContentRepository;
import com.inspur.edp.metadata.rtcustomization.servermanager.dac.api.MetadataRtContentBasicRepository;
import io.iec.caf.data.jpa.repository.CafI18nColumnDict;
import io.iec.edp.caf.commons.utils.SpringBeanUtils;

import java.util.List;

/**
 * 元数据仓库数据库存储
 * 只是转掉元数据jpa
 *
 * @author liangff
 * @since 0.1.0
 * 2024/11/25
 */
public class MetadataRtContentDbRepositoryImpl implements MetadataRtContentBasicRepository {
    private final MetadataRtContentRepository metadataRtContentRepository = SpringBeanUtils.getBean(MetadataRtContentRepository.class);

    public void save(GspEmbeddedMdRtContent gspEmbeddedMdRtContent, CafI18nColumnDict CafI18nColumnDict) {

        metadataRtContentRepository.save(gspEmbeddedMdRtContent, CafI18nColumnDict);
    }

    public GspEmbeddedMdRtContent findByMetadataId(String metadataId) {
        return metadataRtContentRepository.findByMetadataId(metadataId);
    }

    public GspEmbeddedMdRtContent findByMetadataIdAndSourceType(String metadataId, int sourceType) {
        return metadataRtContentRepository.findByMetadataIdAndSourceType(metadataId, sourceType);
    }

    public void deleteByMetadataId(String metadataId) {
        metadataRtContentRepository.deleteByMetadataId(metadataId);
    }

    public List<GspEmbeddedMdRtContent> findAllGspMdRtContents(
            List<String> metadataTypes,
            int typeSize,
            List<String> businessObjectIds,
            int objSize,
            String metadataNamespace,
            String metadataCode,
            Integer sourceType,
            String mdpkgId) {
        return metadataRtContentRepository.findAllGspMdRtContents(metadataTypes, typeSize, businessObjectIds, objSize, metadataNamespace, metadataCode, sourceType, mdpkgId);
    }

    public List<GspEmbeddedMdRtContent> findAllGspMdRtContentsByMdpkgId(String mdpkgId) {
        return metadataRtContentRepository.findAllGspMdRtContentsByMdpkgId(mdpkgId);
    }

    public List<GspMdRtContentSuInfo> findAllGspMdRtContentSuInfo() {
        return metadataRtContentRepository.findAllGspMdRtContentSuInfo();
    }

    public List<GspEmbeddedMdRtContent> findAllSimpleGspMdRtContents(List<String> metadataTypes, int typeSize, Integer sourceType) {
        return metadataRtContentRepository.findAllSimpleGspMdRtContents(metadataTypes, typeSize, sourceType);
    }
}
